package com.dragon.modules.yuegou.enums.code;

import com.dragon.common.constant.enums.IBusinessCode;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 会员业务状态码
 * 
 * @author 刘武
 *
 */
public enum WalletCode implements IBusinessCode {

	/**
	 * 员工与企业信息不符
	 * */
	EMPLOYEES_NOT_EXIST(15001,"员工与企业信息不符"),

	/**
	 * 悦卡库存不足
	 * */
	CARD_STOCK_NOT_ENOUGH(15002,"悦卡库存不足"),

	/**
	 * 悦卡名称不能重复
	 * */
	CARD_TITLE_EXIST(15003,"悦卡名称不能重复"),

	/**
	 * 批量发放悦卡模板未检测到有效数据行
	 * */
	EXCEL_DATA_NULL(15004,"批量发放悦卡模板未检测到有效数据行"),

	/**
	 * 悦卡信息不能为空
	 * */
	CARD_NOT_NULL(15005,"悦卡信息不能为空"),

	/**
	 * 可用商户不能为空
	 * */
	MERCHANT_NOT_NULL(15006,"可用商户不能为空"),


	ORDER_STATUS_ERROR(15007,"订单状态不对"),

	YUE_COIN_NOT_SUFFICIENT_FUNDS(15008,"悦币余额不足"),

	FEE_TOO_LESS(15009,"金额过小"),

	YUE_CARD_EXPIRED(15010,"悦卡已过期"),

	YUE_CARD_UNUSED_TIME(15011,"悦卡未到使用时间"),

	YUE_CARD_PRACTICAL_FEE(15012,"悦卡支付金额不对"),

	YUE_CARD_REMAIN_LESS(15013,"悦卡可用余额不足"),

	YUE_CARD_LIMIT_AMOUNT_THAN(15014,"悦卡超过限额"),

	YUE_CARD_UNKNOWN_SOURCE(15015,"未知的悦卡来源"),

	TRADE_RECORD_UNKNOWN_SOURCE(15016,"未知的交易类型"),

	CARD_NOTNULL(15018,"请选择悦卡"),
	/**
	 * 提取码错误或者已被使用
	 */
	EXTRACT_CODE_INVALID(15019,"无效的提取码"),
	/**
	 * 提取码已失效
	 */
	EXTRACT_CODE_EXPIRED(15020,"提取码已失效"),
	/**
	 * （通过分享给出的）赠送的悦卡已被领取
	 */
	PRESENT_RECEIVED(15021,"悦卡已被领取"),
	/**
	 * （通过分享给出的）赠送的悦卡已被拒绝（不可以再次领取）
	 */
	PRESENT_REJECTED(15022,"赠送已被拒绝"),
	/**
	 * （通过分享给出的）赠送的悦卡已失效（不可以再次领取）
	 */
	PRESENT_EXPIRED(15023,"赠送已失效"),

	CARD_TYPE_WRONG(15024,"预付卡不能退卡"),

	CARD_REMAIN_NOT_ENOUGH(15025,"该卡余额为零，不能退卡"),

	GRANT_CARD_TYPE_WRONG(15026,"预付卡不能发放"),

	OLD_PAY_PWD_ERROR(15027,"旧密码错误"),

	TWO_PAY_PWD_ERROR(15028,"密码不一致"),

	CARD_NO_INVALID(15029,"无效的悦卡卡号，找不到对应悦卡"),

	CARD_NOT_USED(15030,"悦卡不能在当前商户使用"),

	PRESENT_RECEIVED_STATUS_ERROR(15031,"悦卡赠送状态不对"),
	/**
	 * 状态码说明
	 */
	ERROR(15032, "未知的错误"),

	CARD_TYPE_ERROR(15033,"福利卡不能退卡"),

	CARD_RETUND_STAUTS_ERROR(15034,"预付卡设置不能退卡"),

	PRESENT_CARD_BIG(15035,"单次最多赠送悦卡%s张"),

	GRANTED_CARD_CAN_NOT_PRESENT(15036,"福利卡不可赠送"),

	EXIST_NOT_BELONG_MEMBER_CARD(15037,"存在不属于当前会员的悦卡"),

	CARD_IS_REFUND(15038,"悦卡已退卡，不可赠送"),

	CARD_IS_PRESENTING(15039,"悦卡已处于赠送中，不可重复赠送"),

	CARD_IS_PRESENTED(15040,"悦卡已赠送，不可重复赠送"),

	CARD_IS_USED(15041,"悦卡已使用，不可重复赠送"),
	
	BATCH_CONFU_JIES(15042,"选中的数据中含已结账数据，不能重复结账，请从新选择"),

	REPEAT_TRADE(15043,"重复交易"),

	INSUFFICIENT_ACCOUNT_AMOUNT(15044,"账户金额不足"),

	WITHDRAW_AMOUNT_ERROR(15045,"提现金额错误"),

	MEMBERCARD_IS_REFUND(15046,"悦卡已退卡"),

	DIFFERENT_SETTLEMENT_CYCLES(15047,"存在不同的结算周期"),
	
	CARD_TEMPLATE_EXPIRED(15048,"悦卡模板已过期"),
	
	AUDITED_RECORDING(15049,"该记录已经审核不能重复审核"),

	EXCEL_SALES_DATA_NULL(15050,"批量导入销售数据模板未检测到有效数据行"),
	PLEASE_VERIFY_ACCOUNT(15996,"请确认账户"),

	UN_PAYMENT(15051,"未付款不能提交"),

	CHECK_STATUS_ERROR(15052,"审核状态不对"),

	CARD_IS_BINDING(15053,"悦卡已绑定，不可重复绑定"),

	NO_RELEVANT_CARD_INFORMATION_WAS_FOUND(15054,"未找到相关卡信息"),
	INCORRECT_CARD_PASSWORD(15055,"输入卡密码错误"),
	THE_CARD_IS_INACTIVE(15056,"该卡未激活"),

	ENTITY_CARD_WRONG(15057,"实体卡才能绑定"),

	CARD_REMAIN_NOT_UNBIND(15058,"该卡余额为零，不能解绑"),

	CARD_STATUS_WRONG(15059,"实体卡不是绑定状态，不能解绑"),
    THE_CURRENT_STATE_IS_NOT_A_PENDING_STATE(15060,"当前状态不是待激活状态，不能确认收货"),
    THE_CURRENT_STATE_IS_NOT_DERELICT(15061,"当前状态不是废弃状态，不能确认退款"),
	YUE_CARD_UNBINGING(15062,"悦卡未绑定，不能支付"),
	ENTITY_CARD_CAN_ONLY_BE_WELFARE_CARD(15063,"实体卡只能是福利卡"),
	THE_CARD_IS_DEACTIVATED(15064,"该卡已注销作废"),
	ENTITY_CARD_LIMIT_ERROR(15065, "该实体卡每个手机号仅支持绑定%s张，您已达到限制数量"),

	YUE_CARD_NONSUPPORT_DHYSH(15066,"悦卡不支持大汉悦生活"),

	/**
	 * 状态码说明
	 */
	WAIT_RECEIVING_ERROR(15997,"当前状态不是审核中状态，不能确认收货"),
	CHECKING_ERROR(15998,"当前状态不是审核中状态，不能废弃"),
	UNIFIED_ERROR(15999,"当前状态不是未审核状态，不能确认收款"),
	BIND_WECHANT(16000,"该微信账号已绑定过其他账号，请尝试绑定其他微信"),
	WITHDRAW_ERROR(16001,"提现处理中"),



	TODO(15000, "提示消息");
	
	private final Integer code;

	private final String message;

	private WalletCode(Integer code, String message) {
		this.code = code;
		this.message = message;
	}

	public Integer getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	/**
	 * 把code转化为ResponseCode枚举
	 * 
	 * @param code 代码
	 * @return
	 */
	public static WalletCode from(Integer code) {
		if (code == null) {
			return null;
		}
		return CODE_MAP.get(code);
	}

	/**
	 * Code Map for ResponseCode
	 */
	private static final Map<Integer, WalletCode> CODE_MAP = Stream.of(WalletCode.values())
			.collect(Collectors.toMap(WalletCode::getCode, e -> e));
	
}
